<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <title>Supervisor - Search Estate</title>
        <link href="style.css" rel="stylesheet" type="text/css"></link>
        <div style="text-align: center;"><h:graphicImage url="/Images/back.png"></h:graphicImage></div>

    </h:head>
    <h:body>
        <h:form prependId="false">
            <div id="wrapper">
                <div id="logo">

                </div>
                <div id="header">
                    <!-- 		<div id="menu">
                    
                            </div>    -->
                </div>
                <div class="page">
                    <div id="page-bgtop">

                        <div id="dummy"></div>
                        <p:panel id="panelsidebar" header="Pages Menu">
                            <ui:include src="MenuSupervisor.xhtml"/>
                        </p:panel>

                        <!-- end #sidebar -->

                        <div id="content">
                            <p:panel header="Search Estate" id="panel"><!--
                                -->                                <p:dataTable id="dtable" var="estate" value="#{supervisorbean.estates}" paginator="true" rows="10"
                                                                                selection="#{supervisorbean.selectedEstate}" selectionMode="single"
                                                                                onRowSelectUpdate="display" >

                                    <f:facet name="header">
                                        List of Estates
                                    </f:facet>
                                    <p:column sortBy="#{estate.type}" filterBy="#{estate.type}">
                                        <f:facet name="header">
                                            <h:outputText value="Type" />
                                        </f:facet>
                                        <h:outputText value="#{estate.type}" />
                                    </p:column>
                                    <p:column sortBy="#{estate.price}"  style="width:15px" filterBy="#{estate.price}">
                                        <f:facet name="header">
                                            <h:outputText value="Price" />
                                        </f:facet>
                                        <h:outputText value="#{estate.price}" />
                                    </p:column>

                                    <p:column sortBy="#{estate.isConstruction}" filterBy="#{estate.isConstruction}">
                                        <f:facet name="header">
                                            <h:outputText value="Construction" />
                                        </f:facet>
                                        <h:outputText value="#{estate.isConstruction}" />
                                    </p:column>

                                    <p:column sortBy="#{estate.isCountryside}" filterBy="#{estate.isCountryside}">
                                        <f:facet name="header">
                                            <h:outputText value="Countryside" />
                                        </f:facet>
                                        <h:outputText value="#{estate.isCountryside eq true ? 'Yes': 'No'}" />
                                    </p:column>

                                    <p:column sortBy="#{estate.district}" filterBy="#{estate.district}">
                                        <f:facet name="header">
                                            <h:outputText value="District" />
                                        </f:facet>
                                        <h:outputText value="#{estate.district}" />
                                    </p:column>
                                    <p:column sortBy="#{estate.province}" filterBy="#{estate.province}">
                                        <f:facet name="header">
                                            <h:outputText value="Province" />
                                        </f:facet>
                                        <h:outputText value="#{estate.province}" />
                                    </p:column>


                                    <p:column style="width:32px">

                                        <p:commandButton ajax="false" action="#{supervisorbean.showEstateDetails}" 
                                                         image="ui-icon ui-icon-extlink">  
                                            <f:setPropertyActionListener value="#{estate}"  
                                                                         target="#{supervisorbean.selectedEstate}" />  
                                        </p:commandButton>  
                                    </p:column>

                                </p:dataTable>
                                <p:commandButton onclick="confirmation.show()" type="button"
                                                 image="ui-icon ui-icon-close">  

                                </p:commandButton>  


                                <p:confirmDialog message="Are you sure about deleting estate?" 
                                                 header="Initiating delete process" severity="alert" widgetVar="confirmation">  

                                    <p:commandButton value="Yes Sure" update="panel" oncomplete="confirmation.hide()"  
                                                     action="#{supervisorbean.deleteEstate}"   />  
                                    <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />   

                                </p:confirmDialog>  

                                <p:messages/>
                            </p:panel>  

                        </div>
                        <!-- end #content -->

                        <div style="clear: both;">&nbsp;</div>
                    </div>

                    <!-- end #page -->

                </div>
                <div id="footer-bgcontent">
                    <div id="footer" align="center">
                        <p>İstanbul Teknik Üniversitesi - Software Engineering Course - Real Estate Management</p>
                    </div>
                </div>
                <!-- end #footer -->
            </div>

        </h:form>
    </h:body>
</html>